/**
 * 随机生成 [0-9a-z]
 * @param len
 * @returns
 */
export function randomString(len = 6) {
  if (len <= 11) {
    return Math.random()
      .toString(36)
      .slice(2, 2 + len)
      .padEnd(len, "0");
  } else {
    return randomString(11) + randomString(len - 11);
  }
}

/**
 * 随机生成颜色
 * @returns 颜色
 * @example
 * ()=> "#23AAF3"
 */
export function randomColor2() {
  return (
    "#" + Math.random().toString(16).slice(2, 8).padEnd(6, "0").toUpperCase()
  );
}

export function randomColor() {
  return (
    "#" +
    Math.floor(Math.random() * 0xffffff)
      .toString(16)
      .padEnd(6, "0")
      .toUpperCase()
  );
}

export function randomInt(min: number, max: number, isIncludeMax = false) {
  return Math.floor(Math.random() * (max - min + (isIncludeMax ? 1 : 0)) + min);
}
